<template>
  <div class="root">我是Child组件</div>
</template>

<script>
import { onBeforeUnmount, onUnmounted } from "vue";
export default {
  setup() {
    onBeforeUnmount(() => {
      console.log("组件销毁之前");
    });

    onUnmounted(() => {
      console.log("组件销毁之后");
    });
  },
};
</script>